from string import Template


var  = 'hello world'
print(f'{var:>20}')
print(f'{var:<<20}')
print(f'{var:^20}')
print(f'{var:>^20}')

num = 1234567890
print(f'{num:>>20,}')
percent_num = -0.12

print(f'{percent_num:>20.2%}')

print(f'{percent_num:+f}')


arr =[1,2,3,4]

print('{0:02},{1:02},{2:02},{3:02}'.format(*arr))
print('{0:02},{1:02},{3:02},{2:02}'.format(*arr))

temp = Template("$name is $age years old.")

str = temp.substitute({'name':'luqiudi','age':10})

print(str)

str2 = temp.substitute(name='lqd',age=10)

print(str2)